<?
/*
 *  GGB - Gelin's Guest Book.
 *  Copyright (C) 2006  Denis Nelubin aka Gelin
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *  http://gelin.ru
 *  mailto:den@gelin.ru
 *
 *  Description:    Second page of installation wizard, Database Parameters.
 *
 *  History:
 *  2006-06-21  Gelin   Initially created.
 *  2008-08-02  Gelin   Now using $_SESSION, added database charset
 */

session_start();
$error = $_SESSION['error'];

$dbHostname = isset($_SESSION['dbHostname']) ? $_SESSION['dbHostname'] : 'localhost';
$dbUsername = isset($_SESSION['dbUsername']) ? $_SESSION['dbUsername'] : 'test';
$dbPassword = isset($_SESSION['dbPassword']) ? $_SESSION['dbPassword'] : '';
$dbName = isset($_SESSION['dbName']) ? $_SESSION['dbName'] : 'test';
$dbCharset = isset($_SESSION['dbCharset']) ? $_SESSION['dbCharset'] : 'utf8';
$dbTablePrefix = isset($_SESSION['dbTablePrefix']) ? $_SESSION['dbTablePrefix'] : 'ggb_';

?>

<html>
<head>
    <title>Step 2 - Installation wizard - GGB</title>
</head>
<body>
    <h1>GGB - Installation wizard - Step 2 of 4</h1>
    <h2>Database access</h2>
    <font color="red"><?=$error?></font>
    <!--
    <P>Select database type:
        <select name="dbType">
            <option value="mySQL">mySQL</option>
        </select>
    </P>
    -->
    <p>You must create MySQL database before.
        For MySQL 5 <strong>it's required to define database charset</strong>,
        the "utf8" is the best choice. You must execute something like this:
        <pre>CREATE DATABASE <?=$dbName?> <?if ($dbCharset != ''):?>CHARSET = <strong><?=$dbCharset?></strong><?endif;?>;</pre></p>
    <p>Please, define database access parameters below:</p>
    <form action="step2_action.php" method="POST">
    <p>
        Hostname: <input type="text" name="dbHostname" maxlength="255" value="<?=$dbHostname?>"/></br>
        Username: <input type="text" name="dbUsername" maxlength="255" value="<?=$dbUsername?>"/></br>
        Password: <input type="text" name="dbPassword" maxlength="255" value="<?=$dbPassword?>"/></br>
        Database name: <input type="text" name="dbName" maxlength="255" value="<?=$dbName?>"/>
    </p>
    <p>
        Please, define MySQL client charset. It should be the same as
        your website pages' charset. Otherwise your should define
        the charset in my.cnf MySQL configuration file.
    </p>
    <p>
        Database charset: <input type="text" name="dbCharset" maxlength="255" value="<?=$dbCharset?>"/>
    </p>
    <p>Please, set up prefix for tables, which will be created by GGB:</p>
    <p>
        Table prefix: <input type="text" name="dbTablePrefix" maxlength="255" value="<?=$dbTablePrefix?>"/>
    </p>
    <p><input type="button" value="&lt;&lt;Back" onClick="javascript: window.location = 'index.php'"/>
        <input type="submit" value="Continue&gt;&gt;"></p>
    </form>
</body>
</html>